package com.cloud.controller;

import com.cloud.service.PaymentService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @BelongsProject: my
 * @BelongsPackage: com.cloud.controller
 * @Author: ji ge
 * @CreateTime: 2024-02-02  12:29
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@RequestMapping("/payment")
public class PaymentController {

    @Resource
    private PaymentService paymentService;

    @Value("${server.port}")
    private String serverPort;

    @GetMapping("/hystrixOk/{id}")
    public String hystrixOk(@PathVariable("id") Integer id) {
        return paymentService.hystrixOk(id);
    }

    @GetMapping("/hystrixTimeOut")
    public String hystrixTimeOut(@PathVariable("id") Integer id) {
        return paymentService.hystrixTimeOut(id);
    }

    @GetMapping("/circuitBreaker/{id}")
    public String circuitBreaker(@PathVariable("id") Integer id) {
        return paymentService.circuitBreaker(id);
    }
}
